package com.ruoyi.risk.service.impl;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.db.mapper.RiskConfigInfoMapper;
import com.ruoyi.db.domain.RiskConfigInfo;
import com.ruoyi.risk.service.IRiskConfigInfoService;
import com.ruoyi.common.core.text.Convert;

/**
 * 风控配置Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-05-26
 */
@Service
@DataSource(DataSourceType.SLAVE)
public class RiskConfigInfoServiceImpl implements IRiskConfigInfoService 
{
    @Autowired
    private RiskConfigInfoMapper riskConfigInfoMapper;

    /**
     * 查询风控配置
     * 
     * @param id 风控配置主键
     * @return 风控配置
     */
    @Override
    public RiskConfigInfo selectRiskConfigInfoById(Long id)
    {
        return riskConfigInfoMapper.selectRiskConfigInfoById(id);
    }

    /**
     * 查询风控配置列表
     * 
     * @param riskConfigInfo 风控配置
     * @return 风控配置
     */
    @Override
    public List<RiskConfigInfo> selectRiskConfigInfoList(RiskConfigInfo riskConfigInfo)
    {
        return riskConfigInfoMapper.selectRiskConfigInfoList(riskConfigInfo);
    }

    /**
     * 查询风控配置列表
     *
     * @param riskConfigInfo 风控配置
     * @return 风控配置
     */
    @Override
    public List<Map<String, Object>> selectRiskConfigInfoListMap(RiskConfigInfo riskConfigInfo)
    {
        return riskConfigInfoMapper.selectRiskConfigInfoListMap(riskConfigInfo);
    }

    /**
     * 新增风控配置
     * 
     * @param riskConfigInfo 风控配置
     * @return 结果
     */
    @Override
    public int insertRiskConfigInfo(RiskConfigInfo riskConfigInfo)
    {
        riskConfigInfo.setCreateTime(DateUtils.getNowDate());
        return riskConfigInfoMapper.insertRiskConfigInfo(riskConfigInfo);
    }

    /**
     * 修改风控配置
     * 
     * @param riskConfigInfo 风控配置
     * @return 结果
     */
    @Override
    public int updateRiskConfigInfo(RiskConfigInfo riskConfigInfo)
    {
        riskConfigInfo.setUpdateTime(DateUtils.getNowDate());
        return riskConfigInfoMapper.updateRiskConfigInfo(riskConfigInfo);
    }

    /**
     * 批量删除风控配置
     * 
     * @param ids 需要删除的风控配置主键
     * @return 结果
     */
    @Override
    public int deleteRiskConfigInfoByIds(String ids)
    {
        return riskConfigInfoMapper.deleteRiskConfigInfoByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除风控配置信息
     * 
     * @param id 风控配置主键
     * @return 结果
     */
    @Override
    public int deleteRiskConfigInfoById(Long id)
    {
        return riskConfigInfoMapper.deleteRiskConfigInfoById(id);
    }
}
